﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Test
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
            homeIndicator1.CurrentLatitude = 1;
            ledSegDisplay1.Value = "-10.0";
            //ledSegDisplay1.HexMod = false;
            //ledSegDisplay1.TrimZeros = true;

            //this.scope1.RemoveCurve(1);

//             Walson.Form.Common.DotLedDisplay dis = new Walson.Form.Common.DotLedDisplay();
//             dis.Location = new Point(10, 10);
//             dis.ColCount = 128;
//             dis.RowCount = 128;
//             this.Controls.Add(dis);
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            homeIndicator1.Heading = trackBar1.Value;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            homeIndicator1.CenterRotate = checkBox1.Checked;
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox2.Checked)
                watch1.StartTimer();
            else
                watch1.StopTimer();
        }

        private void watch1_DoubleClick(object sender, EventArgs e)
        {
            watch1.ResetTimer();
        }

        private void trackBar2_Scroll(object sender, EventArgs e)
        {
            roundCompass1.Heading = trackBar2.Value;
        }

        private void checkBox3_CheckedChanged(object sender, EventArgs e)
        {
            roundCompass1.CenterRotate = checkBox3.Checked;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Walson.SystemTools.GC.ClearMemory();
        }

        decimal value = 0;
        
        decimal value0 = 0;
        private void linearTuner1_ValueChanged(object sender)
        {
            ledSegDisplay1.Value = linearTuner1.Value.ToString("f5");
            return;
            decimal temp = linearTuner1.Value;
            if (temp > 0)
                value0 = Math.Floor(temp * 100) / 100;
            else
                value0 = Math.Ceiling(temp * 100) / 100;

            value = value0 + value1;
            ledSegDisplay1.Value = value.ToString();
        }
        decimal value1 = 0;
        private void tuner1_ValueChanged(object sender)
        {
            return;   
            value1 =(decimal) tuner1.Value / 10000;
            value = value0 + value1;

            if (tuner1.Value == tuner1.Max)
            {
                value1 = 0;
            }

            linearTuner1.Value = value;
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                watch1.SetMode(Walson.Form.FlightInstrument.Watch.Mode.Watch);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton2.Checked)
                watch1.SetMode(Walson.Form.FlightInstrument.Watch.Mode.Timer);
        }

        private void btnChangeWord_Click(object sender, EventArgs e)
        {
            DotLedDisplay1.Text = txbWord.Text;
        }

        private void ckbMoveDotScreen_CheckedChanged(object sender, EventArgs e)
        {
            DotLedDisplay1.Animation = ckbMoveDotScreen.Checked;
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton3.Checked)
                ledSegDisplay1.Alignment = Walson.Form.Common.SegSevenDisplay.StringAlignment.Near;
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton4.Checked)
                ledSegDisplay1.Alignment = Walson.Form.Common.SegSevenDisplay.StringAlignment.Far;
        }
    }
}
